<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-8-9
 * Time: 下午 06:01
 */
function DB_isset()
{
    $configPath = getAbsolutePath(__DIR__, '../../config/config.php');
    $config = require $configPath;
    $_mysqli = new mysqli($config['db']['DB_HOST'], $config['db']['DB_USER'], $config['db']['DB_PASS']);
    if (mysqli_connect_errno()) {
        exit('连接数据库出错');
    }
    $result = $_mysqli->query('use '.$config['db']['DB_NAME']);
    if ($result) {
        return true;
    } else {
        return false;
    }
}
